package com.wg.photo;

import android.app.Activity;
import android.content.Intent;

import com.wg.photo.activity.ChoosePictureActivity;
import com.wg.photo.utils.PickConfig;


/**
 * Created by Went_Gone on 2017/5/18.
 */

public class PictureView {
    private Activity activity;
    private static PictureView pictureView;
   /* public static PictureView getIntance(Activity activity){
        if (pictureView!=null){
            synchronized (PictureView.class){
                if (pictureView!=null){
                    pictureView = new PictureView(activity);
                }
            }
        }
        return pictureView;
    }*/

    public PictureView(Builder builder) {
        this.activity = activity;
        activity = builder.activity;
    }

    private void start(){
        Intent intent = new Intent(activity, ChoosePictureActivity.class);
        activity.startActivityForResult(intent, PickConfig.LIST_PICTURE_DATA);
    }


    public static class Builder{
        Activity activity;

        public Builder(Activity activity) {
            this.activity = activity;
        }

        private PictureView create(){
            return new PictureView(this);
        }
        public void start(){
            create().start();
        }
    }
}
